<div class="templatemo-content-wrapper">
  <div class="templatemo-content">
   <ul class="nav nav-tabs mytabs">
     <li>
       <a href="<?=site_url()?>/message/index">
         <i class="icon iconfont icon-back"></i> 返回
      </a>
      </li>
     <li class="active"><a href="<?=site_url()?>/product/add"> 发布通知</a></li>
  </ul>
    <div class="row">
      <div class="col-md-12" style="padding-top:20px;">
        <form class="form-horizontal" id="form">
          <div class="row">

          </div>
          <!-- <?=form_input('标 题', 'title', '', true, '')?> -->
          <!-- <?=form_textarea('内 容', 'content', '', true, '')?> -->
          <div class="form-group">
            <label class="col-sm-1 control-label">标 题</label>
            <div class="col-sm-5">
              <input type="text" name="title" class="form-control" data-format="" data-required="1" placeholder="请输入标题" value="">
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-1 control-label">内 容</label>
            <div class="col-sm-9">
              <div id="editor">

              </div>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-1 col-sm-10">
              <button type="button" class="btn btn-primary" id="submit">一键发送</button>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
<style media="screen">
.modal{
  z-index:999999;
}
  .modal-backdrop{
    z-index:99999;
  }
</style>

<script src="<?=base_url()?>js/wangEditor.min.js"></script>
<script type="text/javascript">
    var E = window.wangEditor
    var editor = new E('#editor')
    // 或者 var editor = new E( document.getElementById('editor') )
    editor.create()
</script>
<script>
$(document).ready(function() {

  var form = new dform.create('#form', '#submit')

  $('#submit').click(function(){
    form.submit(function(data){
      data.content = editor.txt.html()
      //data.type = $('input[name="type"]:checked').val()
      //alert($('input[name="type"]:checked').val())
      dconfirm('确定发送该通知？').ok(function(){
        drqt.post('<?=site_url()?>/message/save', data, function(data){
          form.reset()
          //dalert(data.msg)
          //dtoast.success(data.msg)
          dlocation.go('<?=site_url()?>/message/index/', {toastsuccess: data.msg})
        })
      }).no(function(){
        form.reset()
      })
    })
  })

});
</script>
